package wiki.douzi.helpyougrow.service.impl;

import wiki.douzi.helpyougrow.domain.GoodsOrder;
import wiki.douzi.helpyougrow.mapper.GoodsOrderMapper;
import wiki.douzi.helpyougrow.service.GoodsOrderService;
import org.springframework.stereotype.Service;

import java.util.List;
import javax.annotation.Resource;

/**
 * (GoodsOrder)表服务实现类
 *
 * @author Douzi
 * @since 2022-06-18 16:39:18
 */
@Service("goodsOrderService")
public class GoodsOrderServiceImpl implements GoodsOrderService {
    @Resource
    private GoodsOrderMapper goodsOrderMapper;

    /**
     * 查询所有数据
     *
     * @return 实例对象集合
     */
    @Override
    public List<GoodsOrder> queryAll() {
        return this.goodsOrderMapper.queryAll();
    }

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GoodsOrder queryById(Integer id) {
        return this.goodsOrderMapper.queryById(id);
    }

    /**
     * 新增数据
     *
     * @param goodsOrder 实例对象
     * @return 实例对象
     */
    @Override
    public GoodsOrder insert(GoodsOrder goodsOrder) {
        this.goodsOrderMapper.insert(goodsOrder);
        return goodsOrder;
    }

    /**
     * 修改数据
     *
     * @param goodsOrder 实例对象
     * @return 实例对象
     */
    @Override
    public GoodsOrder update(GoodsOrder goodsOrder) {
        this.goodsOrderMapper.update(goodsOrder);
        return this.queryById(goodsOrder.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.goodsOrderMapper.deleteById(id) > 0;
    }
}

